//
//  pictureCell.m
//  CLPictureAmplify
//
//  Created by darren on 16/8/25.
//  Copyright © 2016年 shanku. All rights reserved.
//

#import "pictureCell.h"
#import "LMLGestureHeadImageScrollView.h"

#define SCREEN_WIDTH  ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

@interface pictureCell()
@property (weak, nonatomic) IBOutlet UIImageView *picView;

@end

@implementation pictureCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.picView.userInteractionEnabled = YES;
    self.picView.hidden = YES;
    [self.picView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImageForDismiss)]];
    
}

- (void)clickImageForDismiss
{
    self.clickCellImage();
}

-(void)setImgSource:(NSString*)imgUrl{
    LMLGestureHeadImageScrollView *imageScroll =  [[LMLGestureHeadImageScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64) andHeadImageUrlStr:imgUrl];
    [imageScroll addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImageForDismiss)]];
    [self addSubview:imageScroll];
    
    self.picView.contentMode = UIViewContentModeScaleAspectFit;
}

- (void)setPicImg:(UIImage *)picImg
{
    LMLGestureHeadImageScrollView *imageScroll =  [[LMLGestureHeadImageScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64) andHeadImage:picImg];
    [imageScroll addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImageForDismiss)]];
    [self addSubview:imageScroll];
    
    _picImg = picImg;
//    self.picView.image = picImg;
    self.picView.contentMode = UIViewContentModeScaleAspectFit;
}

@end
